package br.com.covosys.jsf;

import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sun.faces.application.ActionListenerImpl;

public class CovoSYSActionListener extends ActionListenerImpl {
	
	private Logger logger = LoggerFactory.getLogger(CovoSYSActionListener.class);
	
	@Override
	public void processAction(ActionEvent actionEvent) {
		
		FacesContext facesContext = FacesContext.getCurrentInstance();
		
		try {
		
			System.out.println("Chamando evento");
			super.processAction(actionEvent);
			System.out.println("Terminando evento");
		
		} catch (Exception exception) {
			
			logger.debug("Erro", exception);
			facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext, null, JSFKeys.ERROR);
			
		}
		
	}
}
